<!--#include file="inc/conn.asp" -->
<!--#include file="inc/function.asp" -->
<!--#include file="inc/pageClass.asp"-->
<%
If request("Action") = "Del" Then
Id = request("Id")
set rs=conn.execute("delete from PayLog where ID in ("&Id&")")
End If

txtSearch = Trim(checkstr(request("txtSearch")))
SearchType = Trim(request("SearchType"))
SearchType2 = Trim(request("SearchType2"))
startime = Trim(request("startime"))
endtime = Trim(request("endtime"))
orderlist = Trim(request("orderlist"))
trade_status = Trim(request("trade_status"))
servicer = Trim(request("servicer"))
PayTime = Trim(request("PayTime"))

Select Case SearchType
    Case "1"
        SearchType = "UserName"
    Case "2"
        SearchType = "UserId"
    Case "3"
        SearchType = "PayNo"
    Case "4"
        SearchType = "Trade_No"
    Case  "5"
        SearchType = "trade_status"
    Case  "6"
        SearchType = "buyer_email"
    Case  "7"
        SearchType = "Payip"
    Case  "8"
        SearchType = "ServerId"
    Case  "9"
        SearchType = "PayTime"
    Case  "10"
        SearchType = "Remark"
End Select

Select Case orderlist
    Case "1"
        orderlist = " trade_status desc,amount"
    Case "2"
        orderlist = " gamecash"
    Case Else
		orderlist = "id"
End Select



If txtSearch<>""  Then
	If SearchType2="1" then
		sqlstr =  "and "&SearchType&" like '%"&txtSearch&"%'"
	Else
		sqlstr =  "and "&SearchType&" = '"&txtSearch&"'"
	End If 
End If


If trade_status<>"" And IsNumeric(trade_status)  Then
		sqlstr =  sqlstr&"and trade_status="&trade_status&" "
		session("trade_status")=trade_status
End If

If servicer<>"" And IsNumeric(servicer)  Then
		sqlstr =  sqlstr&"and servicer='"&servicer&"' "
		session("servicer")=servicer
End If

If PayTime<>"" And IsNumeric(PayTime)  Then

Select Case PayTime
	Case 1
		sqlstr =  sqlstr&" and  datediff(day,PayTime,getdate())=0"
	Case 2
		sqlstr =  sqlstr&" and  datediff(week,PayTime,getdate())=0"
	Case 3
		sqlstr =  sqlstr&" and  datediff(month,PayTime,getdate())=0"
	Case 4
		sqlstr =  sqlstr&" and  datediff(year,PayTime,getdate())=0"
End Select

session("PayTime")=PayTime
End If

If IsDate(startime) And IsDate(endtime) Then 
			'acc数据库 sqlstr2 =  " and  paytime between #"&startime&"# and #"&endtime&"#"
			sqlstr2 =  " and  paytime between '"&startime&"' and '"&endtime&"'"
End If 

sql="select *  from PayLog  where 1=1 "&sqlstr&"  "&sqlstr2&" Order By "&OrderList&" desc"
'response.write sql

  Set Rs = Server.CreateObject("ADODB.Recordset")
  Rs.Open sql,conn_p,1,1
  Set page = New PageClass
    page.rs=Rs					'直接传递rs对象，传递成功后会自动关闭。如需要开启，请注释掉分页类的第87行val.Close。
    page.PageSize=Mypagesize					'分页大小
    page.setCount=-1					'可选。设置数据总数。0：使用RecordCount，-1：使用Count（默认），其他正数：指定的数据总数。
    page.PageID="p"					'Request.QueryString中分页参数字符串

strtitle=ServerName&"-充值管理"
Call  head(strtitle)
If browser()="pc" Then Call  LeftMenu()
%>

  <!-- 右侧主体开始 -->
  <div class="page-content">
<%Call  mnav()%>	
<div class="weadmin-body">



 <div class="layui-card">
<div class="layui-card-body">
<table width="99%" cellpadding="2" cellspacing="0">
  <tr>
    <td >

<form  class="layui-form layui-col-space"action="Pay_List.asp" method="get" name="form">

              <div class="layui-inline layui-show-xs-block"><input name="txtsearch" type="text" id="txtsearch" class="layui-input"  style="WIDTH: 218px"></div>
              <div class="layui-inline layui-show-xs-block"><input name="startime" type="text" id="startime" class="layui-input" value="<%=date()-364%>" size="12"></div>
              <div class="layui-inline layui-show-xs-block"><input name="endtime" type="text" id="endtime" class="layui-input" value="<%=date()%>" size="12"></div>
             <div class="layui-inline layui-show-xs-block" style="WIDTH: 120px">
			 <select name="SearchType" id="SearchType" >
              <option value="1">用户名</option>
              <option value="2">用户ID</option>
              <option value="3">订单号</option>
              <option value="4">交易号</option>
              <option value="7">IP地址</option>
              <option value="8">服务器</option>
              <option value="9">付款时间</option>
              <option value="10">备注信息</option>
            </select></div>



	<div class="layui-inline layui-show-xs-block">
								<input  name="SearchType2" type="checkbox" name="SearchType2" title="模糊" value="1">
								</div>


<div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn layui-btn-normal layui-btn-sm"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>搜索订单</button>
                                </div>
          </form>

		</td>
    <td>
	</div>
	</td>
  </tr>
</table>

                        </div>
                    </div>
		
		

                        <div class="layui-card-body layui-table-body layui-table-main" style="margin-top:-18px">
                            <table class="layui-table layui-form">


						<form  class="layui-form layui-col-space5" name="form1" method="post" action="?">
                            <table class="layui-table layui-form">
                                <thead>
                                  <tr>
									
									<th height="30" width="110">用户名</th>
                                    <th width="110"><a href="Pay_List.asp?orderlist=1">金额 </a>/<a href="Pay_List.asp?orderlist=2"> 商城</a></th>
                                    <th width="90"><div class="layui-inline layui-show-xs-block" style="width: 90px"><select name="ShowQQ2" onChange="var jmpURL=this.options[this.selectedIndex].value;if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0;}">
            <option value="?servicer="<%if session("servicer")="" then response.Write(" selected")%>>服务商</option>
            <option value="?servicer=1" <%if session("servicer")="1" then response.Write(" selected")%>>支付宝</option>
            <option value="?servicer=2" <%if session("servicer")="2" then response.Write(" selected")%>>工行</option>
            <option value="?servicer=3" <%if session("servicer")="3" then response.Write(" selected")%>>建行</option>
            <option value="?servicer=4" <%if session("servicer")="4" then response.Write(" selected")%>>农行</option>
            <option value="?servicer=5" <%if session("servicer")="5" then response.Write(" selected")%>>其他</option>
          </select> </div></th>
                                    <th width="90"><div class="layui-inline layui-show-xs-block" style="width: 90px"><select name="trade_status" onChange="var jmpURL=this.options[this.selectedIndex].value;if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0;}">
            <option value="?trade_status=" <%if session("trade_status")="" then response.Write(" selected")%>>状态</option>
            <option value="?trade_status=0" <%if session("trade_status")="0" then response.Write(" selected")%>>未付款</option>
            <option value="?trade_status=1" <%if session("trade_status")="1" then response.Write(" selected")%>>已付款</option>
            <option value="?trade_status=2" <%if session("trade_status")="2" then response.Write(" selected")%>>交易成功</option>
            <option value="?trade_status=3" <%if session("trade_status")="3" then response.Write(" selected")%>>后台订单</option>
          </select> </div></th>
                                   
                                    <th width="150"><div class="layui-inline layui-show-xs-block" style="width: 110px"><select name="ShowQQ3" onChange="var jmpURL=this.options[this.selectedIndex].value;if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0;}">
            <option value="?PayTime=" <%if session("PayTime")="" then response.Write(" selected")%>>所有时间</option>
            <option value="?PayTime=1" <%if session("PayTime")="1" then response.Write(" selected")%>>今天</option>
            <option value="?PayTime=2" <%if session("PayTime")="2" then response.Write(" selected")%>>本周</option>
            <option value="?PayTime=3" <%if session("PayTime")="3" then response.Write(" selected")%>>本月</option>
            <option value="?PayTime=4" <%if session("PayTime")="4" then response.Write(" selected")%>>今年</option>
          </select> </div></th>
						<th width="110">订单号</th>
						<th ><div style="position: absolute;  top: 50%;  transform: translateY(-50%);">订单备注</div> <div style="float: right;"><input name="Action" type="hidden" id="Action" value="Del"><button class="layui-btn layui-btn-danger  layui-btn-sm" onClick="{if(confirm('该操作不可逆转！您确定执行吗?')){return true;}return false;}"><i
          class="layui-icon layui-icon-delete"></i>删除订单</button></div></th>
						<th width="15">
								<input type="checkbox" name="chkall" value="on" lay-skin="primary"onClick="CheckAll(this.form)">
								
						
								
								</th>

									</tr>
                                </thead>
                                <tbody>
								       <%
									  If page.eof Or page.bof Then 
									 response.write "<TR><TD>没有找到任何记录...</TD></TR>"
									 Else
										
									 Do While Not page.EOF
									 %>


                                  <tr>
                                    <td style="height:26px"  ><a href="Edit_User.asp?ID=<%=page("UserID")%>"><%=page("UserName")%></a></td>
									  <td><%=page("Amount")%>/<%=page("GameCash")%></td>
                                    <td><%
		  select case page("servicer")
			case "1"
		  response.write"支付宝" 
		   case "2"
		  response.write"工商" 
		   case "3"
		  response.write"建设" 
		   case "4"
		  response.write"农行" 
		   case else
		  response.write"其他"
		  end select 
		  %></td>
									 <td><%
		  select case page("trade_status")
		  	case 0
		  response.write"未付款" 
			case 1
		  response.write"<font color=""#0000FF"">已付款</font>" 
		   case 2
		  response.write"<font color=""#FF0000"">成功</font>" 
		   case 3
		  response.write"<font color=""#FF0000"">后台</font>" 
		   case else
		  response.write"异常"
		  end select 
		  %></td>


                                    <td><%=page("Paytime")%></td>
                                    <td><%=page("PayNo")%></td>
                                    <td><%=page("Remark")%></td>
                                    <td><input name="Id" type="checkbox" value="<%=page("id")%>"  lay-skin="primary">

									</td>
                                    
                                    
                                  </tr>




                                                                
<%
   page.MoveNext
	Loop
	End If 
		 %>





                                </tbody>
                            </table>
							</form>
							</div>
                        <div class="layui-card-body ">
                            <div class="page">
                                <div>
								<%=page.Control(10,"{Ctrl} {State}")%> / 执行时间 <%=Int(FormatNumber((Timer() - TimerStart) * 1000, 3))%> ms
								
                                </div>
                            </div>          
                        </div>
                    </div>




		</div>
  </div><%
Set Rs = Nothing
Set page = Nothing
conn.Close
Set conn = Nothing
%>
 </body>
<div id="LAY_democodejs">
<script>
      layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;


        // 监听全选
        form.on('checkbox(checkall)', function(data){

          if(data.elem.checked){
            $('tbody input').prop('checked',true);
          }else{
            $('tbody input').prop('checked',false);
          }
          form.render('checkbox');
        }); 
        
        //执行一个laydate实例
        laydate.render({
          elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
          elem: '#end' //指定元素
        });


      });

    

      /*用户-删除*/
      function member_del(obj,id){
          layer.confirm('确认要删除吗？',function(index){
              //发异步删除数据
              $(obj).parents("tr").remove();
              layer.msg('已删除!',{icon:1,time:1000});
          });
      }



      function delAll (argument) {
        var ids = [];

        // 获取选中的id 
        $('tbody input').each(function(index, el) {
            if($(this).prop('checked')){
               ids.push($(this).val())
            }
        });
  
        layer.confirm('确认要删除吗？'+ids.toString(),function(index){
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
      }
    </script>
	<%Call  footer%>
</body>
</html>